<template>
  <div>
    <detailbanner :sightName="sightName" :bannerImg="bannerImg" :bannerImgs="gallaryImgs" ></detailbanner>
    <DetailHeader ></DetailHeader>
    <div class="content">
      <detailList  :list ="list"></detailList>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
import detailbanner from './components/DetailBanner.vue'
import DetailHeader from './components/Header.vue'
import detailList from './components/List.vue'
export default {
  name: 'Detail',
  components: {
    detailbanner,
    DetailHeader,
    detailList
  },
  mounted () {
    this.getDetailInfo()
  },
  data () {
    return {
      sightName: '',
      bannerImg: '',
      gallaryImgs: [],
      list: []
      // list: [{
      //   title: '成人票',
      //   children: [{title: '成人三馆连票'}]
      // },
      // {
      //   title: '学生票',
      //   children: [{title: '学生三馆连票'}]
      // },
      // {
      //   title: '儿童票',
      //   children: [{title: '儿童三馆连票', children: [{title: '儿童三馆连票'}]}
      //   ]
      // },
      // {
      //   title: '特惠票',
      //   children: [{title: '特惠三馆连票'}]
      // }]
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {params: {id: this.$route.params.id}}).then(this.handleGetDataSucc)
    },
    handleGetDataSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        console.log(data)
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
        this.gallaryImgs = data.gallaryImgs
        this.list = data.categoryList
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
.content
  height: 50rem
</style>
